Repository navigation
fix: bound unbounded fetch calls with 30s AbortSignal.timeout - #169
Open
hermiondev wants to merge 1 commit into
Open
hermiondev wants to merge 1 commit into
hermiondev wants to merge 1 commit into
Conversation
- alchemySendHttp.ts: JSON-RPC HTTP sender had no timeout -> hangs forever if upstream accepts TCP but never replies - sendRestPayload.ts: same pattern in REST payload sender (also amplifies: inside maxRetries loop, each stalled attempt is unbounded) Guarded feature-detect (AbortSignal.timeout) keeps fetch-ponyfill / older runtime compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two send paths in this repo issue
fetchwith no timeout and no AbortSignal, so any request whose upstream accepts the TCP connection but never replies hangs the caller's promise forever:src/web3-adapter/alchemySendHttp.ts:16— the JSON-RPC HTTP sender. Everyweb3.ethcall through an HTTP provider funnels here.src/web3-adapter/sendRestPayload.ts:70— the REST payload sender. Worse here: the unbounded fetch sits inside themaxRetriesloop, so each stalled attempt blocks indefinitely and the retry logic never gets a chance to run.Reproduced on the published npm artifact
@alch/alchemy-web3@1.4.7: provider pointed at a stall server (accepts connections, never responds) →provider.send({method:'eth_blockNumber'})still pending after a 15s watchdog (exit 124). Control: with the signal below, the same request rejects withAbortErrorat ~30s.Fix
Bound both
fetchcall sites withAbortSignal.timeout(30000), feature-detected sofetch-ponyfilland older runtimes (React Native, browsers withoutAbortSignal.timeout) keep working exactly as before — the option key is simply omitted when unsupported.Validation
yarn jeston Node 20.20.2: 3 suites / 8 pass / 0 fail (unchanged from base).AbortErrorafter.Related: same defect class found + PR'd in sibling repos — alchemyplatform/aa-sdk#2571 (
AlchemyRestClient), and archived alchemy-sdk-js (DEFAULT_REQUEST_TIMEOUT = 0).